package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        //程序启动后在控制台输入一个数字，然后该数字开始每秒递减，当数字减到0时，程序结束
        System.out.println("请输入一个数字：");
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        while (i >= 0){
            System.out.println(i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
            i--;
        }
        System.out.println("程序结束了");
    }
}
